﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;

namespace DataTool
{
    public partial class frmOption : Form
    {
        OptionDTO m_refOption;
        public frmOption(OptionDTO option)
        {
            InitializeComponent();
            m_refOption = option;
            ckbIsUseGrid.Checked = option.IsUseGrid;
            nudIsUseGrid.Value = option.GridSize;
            colorChosen.Color = option.GroundImageViewColor;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            m_refOption.IsUseGrid = ckbIsUseGrid.Checked;
            m_refOption.GridSize = (int)nudIsUseGrid.Value;
            m_refOption.GroundImageViewColor = pnlTransColor.BackColor;
            DialogResult = System.Windows.Forms.DialogResult.OK;
            
            Close();

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }

        private void pnlTransColor_MouseUp(object sender, MouseEventArgs e)
        {
            
            if (colorChosen.ShowDialog() == DialogResult.OK)
            {
                pnlTransColor.BackColor = colorChosen.Color;
            }
        }

     

        
    }
}
